<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../icon/aosen/css/font-awesome.min.css" />
    <style type="text/css">
        html,
        body {
            height: 100%;
            background: #f2f2f2;
        }
        .searchBoxOut{
            width: 100%;
            height: 3.6rem;

            position: fixed;
            left:0;
            top: 0;
            display:flex;
      			display:-webkit-flex;
      			flex-direction: column;
      			-webkit-justify-content: flex-end;
        		justify-content: flex-end;
        }
        .searchBoxIn{
            width: 100%;
            height: 2.3rem;
            background: white;
        }
        .goback{
            text-align: center;
            line-height: 2.3rem;
            height: 100%;
            font-size: 10vw;
            color: #666666;
        }
        .centerBox{
            height: 100%;
            display:flex;
      			display:-webkit-flex;
      			flex-direction: column;
      			-webkit-justify-content: center;
        		justify-content: center;
        }
        .dosearch{
            width: 100%;
            height: 1.6rem;
            background: #eeeeee;
            border-radius: 0.8rem;
            overflow: hidden;
        }
        .hotAndHistiry{
            background: white;
            width: 100%;
            margin-top: 2.7rem
        }
        .games-icon{
            width: 2.4rem !important;
            height: 2.4rem !important;
            padding: 0 !important;
            border-radius: 7px;
            overflow: hidden;
            margin: 0.8rem 0.8rem 0.8rem 0;
        }
        .games-icon img{
            width: 100%;
            height: 100%;
            display: block;
        }
        .nodata{
            width: 100%;
            height: 2.4rem;
            text-align: center;
            line-height: 2.4rem;
            border-bottom: 1px solid #dddddd
        }
    </style>
</head>

<body>
    <header>
        <div class="aui-row searchBoxOut">
            <div class="aui-row searchBoxIn">
                <div class="aui-col-xs-1 goback" onclick="closeWin()">
                    <i class="fa fa-angle-left"></i>
                </div>
                <div class="aui-col-xs-11 centerBox">
                    <div class="dosearch aui-row">
                        <div class="aui-col-xs-11" style="height:100%;line-height:1.6rem;padding-left:0.8rem">
                            <input type="text" style="width:95%;height:1.6rem" disabled="">
                        </div>
                        <div class="aui-col-xs-1" style="height:100%;line-height:1.6rem">
                            <i class="aui-iconfont aui-icon-search"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </header>
    <div class="hotAndHistiry">
        <div class="aui-card-list-content searchResult" id="searchResult">
            <ul class="aui-list aui-media-list" id="searchResultList">



            </ul>
            <div class="nodata aui-hide" id="noSearchRelt">抱歉！没有搜索到相关内容~</div>
        </div>
    </div>

</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/request.js"></script>
<script type="text/javascript">
    var searchKey;
    apiready = function() {
    	
        searchKey = api.pageParam.searchKey;
        getSearchRelt('YES','NO');
        $api.val($api.dom('input'), searchKey);

        var header = $api.dom('header');
        // var footer = $api.dom('footer');
        var headerH = $api.fixStatusBar(header);
    };
    function closeWin(){
        api.closeWin();

    }
    function getSearchRelt(loading,isDown){
      var data = {};
      data['values'] = {};
    	data['values']['target'] = searchKey;
    	requestData('Index/doHotSearch',data,loading,'NO',isDown,_callbackSearch);
    }
    function _callbackSearch(ret){
      if(ret.status == 200){
    		if(ret.list.length>0){
    			var html = '';
          $api.addCls($api.byId('noSearchRelt'), 'aui-hide');
    			for(var i=0;i<ret.list.length;i++){
    				html+='<li class="aui-list-item aui-list-item-middle" onclick="goToProList(\''+ret.list[i].id+'\')">';
    				html+='<div class="aui-media-list-item-inner">';
    				html+='<div class="aui-list-item-media games-icon">';
    				html+='<img src="'+pictureUrl+ret.list[i].game_icon+'">';
    				html+='</div>';
    				html+='<div class="aui-list-item-inner aui-list-item-arrow">'+ret.list[i].game_name+' </div>';
    				html+='</div></li>';
    			}
          $api.html($api.byId('searchResultList'), html);

    		}else{
          $api.removeCls($api.byId('noSearchRelt'), 'aui-hide');

        }
    	}
    }
    function goToProList(gameId){
      api.openWin({
					name: 'ProductListPage',
					url: './win.html',
					pageParam: {
							page:'ProductListPage',
							title: '商品列表',
              data:{
              	id:gameId,
              	userType:'seller'
              },
              bounces:true
					}
			});
    }
</script>

</html>
